/*
 * @Description: 流程类型常量
 * @Author: seadon
 * @LastEditors: seadon
 * @Date: 2021-07-08 15:28:08
 * @LastEditTime: 2021-08-04 09:12:30
 */
import { i18n } from '@/locales'
import { ListTypeEnum, myApplyColumn } from '@/constant/enums/processCenter'
import { ITaskType } from '../type'

const { $t } = i18n

const taskType: readonly ITaskType[] = Object.freeze([
	{
		route_name: 'TodoTask',
		title: $t('pages.task.todoTask', '我的待办'),
		count: 0,
	},

	{
		route_name: 'AgentTodo',
		title: $t('pages.task.agentTodo', '代理待办'),
		count: 0,
		// hidden: true,
	},
	{
		route_name: 'Apply',
		title: $t('pages.task.apply', '我的申请'),
		count: 0,
	},
	{
		route_name: 'DoneTask',
		title: $t('pages.task.doneTask', '已办'),
		count: 0,
	},
	{
		route_name: 'TaskNotice',
		title: $t('pages.task.myNotice', '我的知会'),
		count: 0,
	},
	{
		route_name: 'AgentNotice',
		title: $t('pages.task.agentNotice', '代理知会'),
		count: 0,
		// hidden: true,
	},
	{
		route_name: 'ExpactTask',
		title: $t('pages.task.expactTask', '预计待办'),
		count: 0,
	},
	{
		route_name: 'Drafts',
		title: $t('pages.task.drafts', '草稿箱'),
		count: 0,
	},
])

const typeFieldMaps: Recordable<string> = Object.freeze({
	Drafts: 'draft_count',
	TodoTask: 'todo_task_count',
	ExpactTask: 'expect_task_count',
	AgentTodo: 'agent_todo_task_count',
	Apply: 'approve_application_count',
	TaskNotice: 'un_read_notice_count',
	AgentNotice: 'agent_un_read_notice_count',
})

const typeColumnMaps: Recordable<string | object> = Object.freeze({
	Drafts: 'myDraftColumn',
	TodoTask: 'myTodoColumn',
	DoneTask: 'myDoneColumn',
	ExpactTask: 'expectedTodoColumn',
	AgentTodo: 'agentTodoColumn',
	Apply: {
		[myApplyColumn.APPROVE]: 'approvalApplicationColumn',
		[myApplyColumn.WHOLE]: 'approvalApplicationColumn',
		[myApplyColumn.COMPLETE]: 'finishedApplicationColumn',
		[myApplyColumn.TERMINATION]: 'finishedApplicationColumn',
	},
	TaskNotice: 'myNotifyColumn',
	AgentNotice: 'myNotifyColumn',
})

const typeServiceMaps: Recordable<any> = Object.freeze({
	Drafts: 'ListDraftPrivateV2POST', // 草稿箱
	TodoTask: 'ListTodoTaskPrivateV2POST', // 我的待办
	DoneTask: 'ListDoneTaskPrivateV2POST', // 我的已办
	bidDoneTask: 'ListCompetitionDoneTaskPrivateV2POST', // 竞签已办
	ExpactTask: 'ListExpectTaskPrivateV2POST', // 预计待办
	AgentTodo: 'ListAgentTodoTaskPrivateV2POST', // 代理待办
	AgentDoneTask: 'ListAgentDoneTaskPrivateV2POST', //代理已办
	Apply: 'ListApplicationTaskPrivateV2POST', // 我的申请
	TaskNotice: {
		// 我的知会
		[ListTypeEnum.TODO]: 'ListUnreadNoticeTaskPrivateV2POST',
		[ListTypeEnum.DONE]: 'ListReadNoticeTaskPrivateV2POST',
	},
	AgentNotice: 'ListUnreadAgentNoticeTaskPrivateV2POST', // 代理知会
	// {
	// 	[ListTypeEnum.TODO]: 'ListUnreadAgentNoticeTaskPrivateV2POST',
	// 	[ListTypeEnum.DONE]: 'ListReadNoticeTaskPrivateV2POST',
	// },
})
const typeServiceStateMaps = Object.freeze({
	Drafts: 'Drafts',
	TodoTask: 'TodoTask',
	DoneTask: 'DoneTask',
	bidDoneTask: 'bidDoneTask',
	AgentDoneTask: 'AgentDoneTask',
	ExpactTask: 'ExpactTask',
	AgentTodo: 'AgentTodo',
	Apply: 'Apply',
	TaskNotice: 'TaskNotice',
	AgentNotice: 'AgentNotice',
})

const typeTaskCountMaps: Recordable<any> = Object.freeze({
	Drafts: 'CountByTypeDraftPrivateV2POST',
	TodoTask: 'CountByTypeTodoTaskPrivateV2POST',
	DoneTask: 'CountByTypeDoneTaskPrivateV2POST',
	bidDoneTask: 'CountByTypeCompetitionDoneTaskPrivateV2POST',
	AgentDoneTask: 'CountByTypeAgentDoneTaskPrivateV2POST',
	ExpactTask: 'CountByTypeExpectTaskPrivateV2POST',
	AgentTodo: 'CountByTypeAgentTodoTaskPrivateV2POST',
	Apply: 'CountByTypeApplicationTaskPrivateV2POST',
	TaskNotice: 'CountByTypeNoticeTaskPrivateV2POST',
	AgentNotice: 'CountByTypeAgentNoticeTaskPrivateV2POST',
})

export {
	taskType,
	typeFieldMaps,
	typeColumnMaps,
	typeServiceMaps,
	typeTaskCountMaps,
	typeServiceStateMaps,
}
